import 'package:seedfour/generated/json/base/json_convert_content.dart';
import 'package:seedfour/app/models/seal_list_entity.dart';

SealListEntity $SealListEntityFromJson(Map<String, dynamic> json) {
  final SealListEntity sealListEntity = SealListEntity();
  final int? total = jsonConvert.convert<int>(json['total']);
  if (total != null) {
    sealListEntity.total = total;
  }
  final List<SealInfo>? data = (json['data'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<SealInfo>(e) as SealInfo).toList();
  if (data != null) {
    sealListEntity.data = data;
  }
  return sealListEntity;
}

Map<String, dynamic> $SealListEntityToJson(SealListEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['total'] = entity.total;
  data['data'] = entity.data?.map((v) => v.toJson()).toList();
  return data;
}

extension SealListEntityExtension on SealListEntity {
  SealListEntity copyWith({
    int? total,
    List<SealInfo>? data,
  }) {
    return SealListEntity()
      ..total = total ?? this.total
      ..data = data ?? this.data;
  }
}

SealInfo $SealInfoFromJson(Map<String, dynamic> json) {
  final SealInfo sealInfo = SealInfo();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    sealInfo.id = id;
  }
  final String? creatorName = jsonConvert.convert<String>(json['creatorName']);
  if (creatorName != null) {
    sealInfo.creatorName = creatorName;
  }
  final String? taker = jsonConvert.convert<String>(json['taker']);
  if (taker != null) {
    sealInfo.taker = taker;
  }
  final int? createdAt = jsonConvert.convert<int>(json['createdAt']);
  if (createdAt != null) {
    sealInfo.createdAt = createdAt;
  }
  final int? updatedAt = jsonConvert.convert<int>(json['updatedAt']);
  if (updatedAt != null) {
    sealInfo.updatedAt = updatedAt;
  }
  final int? status = jsonConvert.convert<int>(json['status']);
  if (status != null) {
    sealInfo.status = status;
  }
  final int? type = jsonConvert.convert<int>(json['type']);
  if (type != null) {
    sealInfo.type = type;
  }
  final int? sealType = jsonConvert.convert<int>(json['sealType']);
  if (sealType != null) {
    sealInfo.sealType = sealType;
  }
  final int? printNum = jsonConvert.convert<int>(json['printNum']);
  if (printNum != null) {
    sealInfo.printNum = printNum;
  }
  final String? caseId = jsonConvert.convert<String>(json['caseId']);
  if (caseId != null) {
    sealInfo.caseId = caseId;
  }
  final String? archive = jsonConvert.convert<String>(json['archive']);
  if (archive != null) {
    sealInfo.archive = archive;
  }
  final String? rejectRemark = jsonConvert.convert<String>(
      json['rejectRemark']);
  if (rejectRemark != null) {
    sealInfo.rejectRemark = rejectRemark;
  }
  final String? completeRemark = jsonConvert.convert<String>(
      json['completeRemark']);
  if (completeRemark != null) {
    sealInfo.completeRemark = completeRemark;
  }
  final String? createdAtStr = jsonConvert.convert<String>(
      json['createdAtStr']);
  if (createdAtStr != null) {
    sealInfo.createdAtStr = createdAtStr;
  }
  final String? updatedAtStr = jsonConvert.convert<String>(
      json['updatedAtStr']);
  if (updatedAtStr != null) {
    sealInfo.updatedAtStr = updatedAtStr;
  }
  final String? caseName = jsonConvert.convert<String>(json['caseName']);
  if (caseName != null) {
    sealInfo.caseName = caseName;
  }
  return sealInfo;
}

Map<String, dynamic> $SealInfoToJson(SealInfo entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['creatorName'] = entity.creatorName;
  data['taker'] = entity.taker;
  data['createdAt'] = entity.createdAt;
  data['updatedAt'] = entity.updatedAt;
  data['status'] = entity.status;
  data['type'] = entity.type;
  data['sealType'] = entity.sealType;
  data['printNum'] = entity.printNum;
  data['caseId'] = entity.caseId;
  data['archive'] = entity.archive;
  data['rejectRemark'] = entity.rejectRemark;
  data['completeRemark'] = entity.completeRemark;
  data['createdAtStr'] = entity.createdAtStr;
  data['updatedAtStr'] = entity.updatedAtStr;
  data['caseName'] = entity.caseName;
  return data;
}

extension SealInfoExtension on SealInfo {
  SealInfo copyWith({
    String? id,
    String? creatorName,
    String? taker,
    int? createdAt,
    int? updatedAt,
    int? status,
    int? type,
    int? sealType,
    int? printNum,
    String? caseId,
    String? archive,
    String? rejectRemark,
    String? completeRemark,
    String? createdAtStr,
    String? updatedAtStr,
    String? caseName,
  }) {
    return SealInfo()
      ..id = id ?? this.id
      ..creatorName = creatorName ?? this.creatorName
      ..taker = taker ?? this.taker
      ..createdAt = createdAt ?? this.createdAt
      ..updatedAt = updatedAt ?? this.updatedAt
      ..status = status ?? this.status
      ..type = type ?? this.type
      ..sealType = sealType ?? this.sealType
      ..printNum = printNum ?? this.printNum
      ..caseId = caseId ?? this.caseId
      ..archive = archive ?? this.archive
      ..rejectRemark = rejectRemark ?? this.rejectRemark
      ..completeRemark = completeRemark ?? this.completeRemark
      ..createdAtStr = createdAtStr ?? this.createdAtStr
      ..updatedAtStr = updatedAtStr ?? this.updatedAtStr
      ..caseName = caseName ?? this.caseName;
  }
}